package com.sqin.taskflow;

import com.sqin.taskflow.listen.TaskListen;
import com.sqin.taskflow.task.AbsTask;
import com.sqin.taskflow.task.SingleTask;
import lombok.extern.slf4j.Slf4j;

import java.util.logging.Logger;

@Slf4j
public class MyTaskListen extends TaskListen {


    @Override
    public void beforeExecute(AbsTask task) {
        log.info("任务{} 监听'beforeExecute' ",task.getName());
    }

    @Override
    public void afterExecute(AbsTask task) {
        log.info("任务{} 监听'afterExecute' ",task.getName());
    }

    @Override
    public void exception(AbsTask task,Throwable throwable) {
        log.info("监听'exception'  执行异常 {}",throwable.getMessage());
    }

    @Override
    public void executeResult(SingleTask task) {
        log.info("任务{} 监听'executeResult'  执行结果{}",task.getName(),task.getResult());
    }
}
